package com.jintian.smart.kernel.switching.dto.db;

import com.jintian.smart.kernel.switching.db.ExtractRule;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class DBDataPacket implements Serializable {
    private static final long serialVersionUID = 1L;
    private final ExtractRule rule;
    @SuppressWarnings("rawtypes")
    /**
     * 更新数据，key=Table.name.toUpperCase(),value=List<Bean>
     */
    private Map<String, List> upsertData = new HashMap<>();
    /**
     * 删除数据，key=Table.name.toUpperCase(),value=List<Key>
     */
    private Map<String, List<String>> deleteData = new HashMap<>();
    private Map<String, List<Attachment>> attachments = new HashMap<>();

    private long timestamp;

    public List getUpsertData(String name) {
        return this.upsertData.get(name.toUpperCase());
    }

    public List<String> getDeleteData(String name) {
        return this.deleteData.get(name.toUpperCase());
    }
}
